package com.sy.springboottest.action.start;

import com.sy.springboottest.action.demo1.Produce;
import com.sy.springboottest.action.proxy.ProxyUtil;
import com.sy.springboottest.pojo.QueryPojo;
import com.sy.springboottest.pojo.ResultPojo;

import net.sf.cglib.proxy.Enhancer;

public class ClientStart {
	public static void main(String[] args) {
		// 创建Enhancer对象，类似于JDK动态代理的Proxy类
		Enhancer enhancer = new Enhancer();
		// 设置目标类的字节码文件
		enhancer.setSuperclass(Produce.class);
		// 设置回调函数
		enhancer.setCallback(new ProxyUtil());
		
		Produce produce = (Produce) enhancer.create();
	
		QueryPojo queryPojo = new QueryPojo();
		queryPojo.setFirst(1);
		queryPojo.setSecond(2);
		ResultPojo sum = produce.sum(queryPojo);
		System.out.println(sum);
	}
}
